# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Contributor: Martell Malone <martellmalone@gmail.com>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=py3-numpy
pkgver=1.19.1
pkgrel=0
pkgdesc="Scientific tools for Python"
url="https://www.numpy.org/"
arch="all !mips !mips64"
license="BSD-3-Clause"
options="!check"
replaces="py-numpy"
makedepends="python3-dev cython openblas-dev>=0.3.0
	gfortran py3-nose libbsd-dev py3-setuptools
	lapack-dev"
subpackages="$pkgname-dev
	$pkgname-doc
	$pkgname-f2py::noarch"
source="https://github.com/numpy/numpy/releases/download/v$pkgver/numpy-$pkgver.tar.gz
	numpy-1.17.0-musl.patch
	site.cfg"
builddir="$srcdir/numpy-$pkgver"

prepare() {
	default_prepare
	cp "$srcdir"/site.cfg "$builddir"/
}

build() {
	export Atlas=None
	LDFLAGS="$LDFLAGS -shared"
	python3 setup.py build config_fc --fcompiler=gnu95
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir" \
			config_fc --fcompiler=gnu95

	install -D -m 644 LICENSE.txt \
		"$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

f2py() {
	pkgdesc="f2py for numpy (for python3)"
	depends="py3-numpy=$pkgver-r$pkgrel python3-dev"
	install_if="$pkgname-f2py=$pkgver-r$pkgrel python3"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/f2py* "$subpkgdir"/usr/bin/
}

dev() {
	depends_dev="$pkgname"
	default_dev
}

sha512sums="8194e3bc672c79e0744f8807c6c952d0b02f9c10ae0e0a85ccbf3e135adb801da657820496b28f8d6fa0109518533defc698d33902a2feba0e4ddc25a53aaa9c  numpy-1.19.1.tar.gz
2272f400594c1b2a3b69385fe0aa13d54cd12f4c4f1b109fa07789db7eec4bb681a68fd3d95ce9fb1342a5f76394e2381bb5fa8542631fc50b9a9335c512c690  numpy-1.17.0-musl.patch
21ca8db304cbbf5949f07702f2a42bb5e5a0d641921e36649555a41b0e48f04e96f53760417823177ac27f6de24b2191e6e1d5f0eb393beafa29f7484e23284f  site.cfg"
